$(function () {
    $.ajax({
        url: '/user/queryUserMessage',
        type: 'get',
        success: function (info) {
            if (info.error) {
                location.href = 'login.html'
                return
            }
            $('.user_message').html(template('tmp', info))
        }
    })

    // 退出登录
    $('.logout_box button').on('click', function () {
        $.ajax({
            url: '/user/logout',
            type: 'get',
            success: function (info) {
                if (info.success) {
                    location.href = 'login.html'
                } 
            }
        })
    })
})